﻿using BCCommon;
using BCCommon.Enums;
using BCCommon.PaymentEnums;
using BCDto.Sim.Admin.Admin;
using BCDto.TMS.AgentFlowRecord;
using BCDto.TMS.AgentWallet;
using System;

namespace BCService.TMS.AgentWallet
{
    public interface IAgentWalletService
    {
        /// <summary>
        /// 余额充值
        /// </summary>
        /// <param name="admin"></param>
        /// <param name="rechargeAmount"></param>
        /// <param name="rechargeNo"></param>
        /// <param name="channelType"></param>
        /// <returns></returns>
        AgentWalletDto BalanceRecharge(AdminDto admin, decimal rechargeAmount, string rechargeNo, PaymentChannelType channelType);
        /// <summary>
        /// 修改阿里支付信息
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="payAuthInfo"></param>
        /// <returns></returns>
        int ChangeAliPayAuthInfo(long userId, string payAuthInfo);
        /// <summary>
        /// 修改支付密码
        /// </summary>
        /// <param name="admin"></param>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        AgentWalletDto ChangePayPassword(AdminDto admin, AgentWalletResetRequestDto requestDto);
        /// <summary>
        /// 修改微信支付信息
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="payAuthInfo"></param>
        /// <returns></returns>
        int ChangeWxPayAuthInfo(long userId, string payAuthInfo);
        /// <summary>
        /// 清除密码错误次数
        /// </summary>
        void ClearErrorCount();
        /// <summary>
        /// 首次设置密码
        /// </summary>
        /// <param name="admin"></param>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        AgentWalletDto FirstSetPayPassword(AdminDto admin, AgentWalletRequestDto requestDto);
        /// <summary>
        /// 获取代理商流水记录
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="orderNo"></param>
        /// <param name="flowType"></param>
        /// <param name="flowDirection"></param>
        /// <param name="payChannel"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="ascending"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        PageableList<AgentFlowRecordDto> GetCurrentDriverWalletDetails(long? agentRecordId, string orderNo, FlowType? flowType,
            FlowDirectionType? flowDirection, PaymentChannelType? payChannel, DateTime? start, DateTime? end, bool? ascending,
            int pageIndex, int pageSize);
        /// <summary>
        /// 获取代理商钱包信息
        /// </summary>
        /// <param name="agentRecordId"></param>
        /// <param name="showPassword"></param>
        /// <returns></returns>
        AgentWalletDto GetWalletByAgentId(long agentRecordId, bool showPassword = false);
        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="agentRecordId"></param>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        AgentWalletDto ResetPayPassword(string phone, long agentRecordId, AgentWalletResetRequestDto requestDto);
        /// <summary>
        /// 修改代理商钱包信息
        /// </summary>
        /// <param name="walletDto"></param>
        /// <returns></returns>
        AgentWalletDto Update(AgentWalletDto walletDto);
        /// <summary>
        /// 修改代理密码输错次数
        /// </summary>
        /// <param name="admin"></param>
        /// <param name="passwordErrorCount"></param>
        /// <returns></returns>
        AgentWalletDto UpdatePasswordErrorCount(AdminDto admin, int passwordErrorCount);
        /// <summary>
        /// 获取指定代理商流水记录
        /// </summary>
        /// <param name="agentRecordId">代理商id</param>
        /// <param name="flowType">流水类型</param>
        /// <param name="flowDirectionType">流水方向</param>
        /// <param name="minAmount">最小金额</param>
        /// <param name="maxAmount">最大金额</param>
        /// <param name="paymentChannelType"></param>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <param name="ascending"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        PageableList<AgentFlowRecordDto> AgentFlowRecord(long agentRecordId, FlowType? flowType, FlowDirectionType? flowDirectionType, decimal? minAmount,
            decimal? maxAmount, PaymentChannelType? paymentChannelType,DateTime? startDate, DateTime? endDate,bool? ascending, int pageIndex, int pageSize);
        /// <summary>
        /// 代理商付款操作
        /// </summary>
        /// <param name="admin">管理员信息</param>
        /// <param name="amount">金额</param>
        /// <param name="remark">备注</param>
        /// <param name="flowType">流水类型</param>
        /// <param name="paymentChannel">支付渠道</param>
        /// <param name="flowDirectionType">流水去向类型</param>
        /// <param name="orderNo">订单编号</param>
        /// <returns></returns>
        AgentWalletDto Pay(AdminDto admin, decimal amount, string remark, FlowType flowType, PaymentChannelType paymentChannel,
                    FlowDirectionType flowDirectionType, string orderNo);
    }
}